/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package babydisco.Math;

/**
 *
 * @author sbavdhorst
 */
public class Morphology {
    public static double[] morphology(Double[] original, Double[] output){
        double sum = 0;
        double max = -1;
        double min = 100000000;
        
        if(original.length != output.length){
            System.out.println("Morphology problem");
            return null;
        }
        
        for(int i=0; i<original.length; i++){
            double dif = Math.abs((output[i]-original[i]));
            sum += dif;
            if(dif>max){
                max = dif;
            }
            if(dif<min){
                min = dif;
            }
        }
        return new double[]{sum/original.length, max, min};
    }
    
}
